workspace "Raw"
    configurations { "Debug", "Release" }

    project "Raw"
        kind "SharedLib"
        targetdir "."

        includedirs { ".." }  -- for StdAfx.hpp

        headers = { "../*.hpp" }
        sources = { "../*.cpp" }

        gen_headers = { "../Gen/*.hxx" }
        gen_sources = { "../Gen/*.cxx" }

        files { headers, sources, gen_headers, gen_sources }
        vpaths {
           ["Header Files/*"] = headers,
           ["Source Files/*"] = sources,
           ["Gen/Headers/*"] = gen_headers,
           ["Gen/Sources/*"] = gen_sources,
        }

        pchheader "StdAfx.hpp"
        pchsource "../StdAfx.cpp"

        py_ver = 36
        pypy = false

        if pypy then py_ver = 27 end
        py_ver_major = py_ver // 10
        py_ver_minor = py_ver % 10
        py_ver_human = py_ver_major .. "." .. py_ver_minor

        if os.target() == "windows" then
            targetextension ".pyd"

            sysdrive = os.getenv("SystemDrive")
            if sysdrive == nil then sysdrive = "C:" end

            if not pypy then
                pyroot = sysdrive .. "/Python" .. py_ver
            else
                pyroot = sysdrive .. "/pypy2"
            end

            includedirs { pyroot .. "/include" }
            libdirs { pyroot .. "/libs" }
            links { "python" .. py_ver }

            if not pypy then
                debugcommand(pyroot .. "/python.exe")
                debugargs "test.py"
            end
        end

        if os.target() == "linux" then
            targetprefix ""

            buildoptions { "`pkg-config python-" .. py_ver_human .. " --cflags`" }
            links { "python" .. py_ver_human }
        end

        filter "action:gmake"
            buildoptions { "-std=c++14" }

        filter "configurations:Debug"
            targetsuffix "_d"

            defines { "DEBUG", "_DEBUG" }
            symbols "On"

        filter "configurations:Release"
            defines { "NDEBUG" }
            optimize "On"
